<div class="container">
    <?php echo validation_errors("<div class='alert alert-danger'>", "</div>"); ?>
    <?php 
        if(isset($existe)) {
            if(strlen($existe) > 0) {
                echo "<div class='alert alert-danger'>".$existe."</div>";
            }
        }
     ?>
    <form class="form-horizontal" method="post">
        
        <div class="control-group">
            <label class="control-label">C&oacute;digo</label>
            <div class="controls">
                <input type="text" class="input-block-level input-medium" name="codigo" id="codigo" value="<?=set_value('codigo')?>">
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Marca</label>
            <div class="controls">
                <select name="marca" class="chosen">
                    <?php foreach($marcas as $marca) { ?>
                    <option value="<?=$marca['idMarca']?>"><?=$marca['nombre']?></option>
                    <?php } ?>
                </select>
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">N&uacute;mero de Orden</label>
            <div class="controls">
                <input type="text" class="input-block-level input-small" name="orden" value="<?=set_value('orden')?>">
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Producto</label>
            <div class="controls">
                <select name="producto" class="chosen">
                    <?php foreach($productos as $producto) { ?>
                    <option value="<?=$producto['idProducto']?>"><?=$producto['nombre']?></option>
                    <?php } ?>
                </select>
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Peso</label>
            <div class="controls">
                <input type="text" class="input-block-level input-small" name="peso" value="<?=set_value('peso')?>">
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label">Precio</label>
            <div class="controls">
                <input type="text" class="input-block-level input-small" name="precio" value="<?=set_value('precio')?>">
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label"></label>
            <div class="controls">
                <button type="submit" class="btn btn-primary">Crear</button>
            </div>
        </div>
        
    </form>
</div>

<script type="text/javascript">
    $(document).ready(function() {
        $("#codigo").focus();
        $(".chosen").chosen();
    });
</script>